package cn.white.ymc.mvvmmaster.data.local;

import android.arch.lifecycle.LiveData;

import cn.white.ymc.mvvmmaster.data.bean.UserInfo;
import cn.white.ymc.mvvmmaster.data.local.service.UserService;
import cn.white.ymc.mvvmmaster.data.local.service.UserServiceImpl;

/**
 *  本地数据请求源
 *
 * Created by 86839 on 2017/10/6.
 */

public class LocalUserDataSource {

    private static final LocalUserDataSource instance = new LocalUserDataSource();
    private LocalUserDataSource() {
    }
    public static LocalUserDataSource getInstance() {
        return instance;
    }

    private UserService userService = UserServiceImpl.INSTANCE;

    public LiveData<UserInfo> queryUserByUsername(String username) {
        return userService.queryByUsername(username);
    }

    public LiveData<Long> addUser(UserInfo user) {
        return userService.add(user);
    }
}
